<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of MainView
 *
 * @author mateusz.ledzewicz
 */
class ViewInstrument extends IndexView{
    //put your code here
        
    public function load() {
        parent::load();
        $this->chooseView('network');
        
    }
    
    protected function chooseView($name){

        $type = (isSet($_GET[ConfigInput::actionGet])) ? $_GET[ConfigInput::actionGet] : null;
        switch($type){
            case ConfigInput::actionList:
                $this->loadContent('instrumentList.html');
                $this->listLoad();
            break;
            case ConfigInput::actionEdit:
                $this->loadContent('instrumentForm.html');
            
            break;
            case ConfigInput::actionDel:
                $this->loadContent('instrumentDel.html');
                
            break;
            default:
                $this->loadContent('instrumentList.html');
                $this->listLoad();
            break; 
        }
    }
    
    protected function listLoad() {
        $list = '
            <tr>
                <td>'.$this->getVar('header_Instrument_LABEL_isin').'</td>
                <td>'.$this->getVar('header_Instrument_LABEL_name').'</td> 
                <td>'.$this->getVar('header_Instrument_LABEL_instrumentType').'</td> 
                <td>Edycja</td>
            </tr>';
        
        foreach($this->specialVariables['list'] as $r)
        {
            $list .= '
            <tr>
                <td>'.$r->isin.'</td>
                <td>'.$r->name.'</td>
                <td>'.$r->instrumentType.'</td>
                <td>
                   Dodać sprawdzanie czy istnieje taki
                </td>
            </tr>';     

         }
         
         
         $this->setVar('addNewLink', '<a href="?step=instrument&action=edit">Dodaj nowe</a>');
         $this->setVar('list', $list);
    }
    



}

?>
